home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / video / scrollmon / CredSection.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.5 KB  |  114 lines

  1. /*
  2.  * Copyright (C) 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <unistd.h>
  20. #include <math.h>
  21. #include <string.h>
  22. #include "wfmclient.h"
  23.  
  24. #define MKRGB(r, g, b)  ((((r)&0xff)<<0) | (((g)&0xff)<<8) | (((b)&0xff)<<16))
  25.  
  26. class FColors {
  27.     int cCnt;
  28.     struct color {
  29.      long icolor;
  30.      char name[80];
  31.     } colors[255];
  32.  
  33.  public:    
  34.     FColors()
  35.      {
  36.       cCnt = 0;
  37.       add(0, 0, 0, "black");
  38.      }
  39.      
  40.     void add(short red,  short green, short blue, char *cname)
  41.      {
  42.       colors[cCnt].icolor = MKRGB(red, green, blue);
  43.       strncpy(colors[cCnt].name, cname, 80);
  44.       cCnt++;
  45.      }
  46.     
  47.     long get(char *cname)
  48.      {
  49.       for (int i = 0; i < cCnt; i++)
  50.         if (!strcmp(colors[i].name, cname))
  51.       return(colors[i].icolor);
  52.      }       
  53. };
  54.  
  55. struct Image {
  56.   short   xpos;
  57.   short   width;
  58.   short   height;
  59.   ulong  *imgBuf;
  60.   short   lastY;
  61. };
  62.  
  63. enum credSectType { FontTypeId, ImageTypeId };
  64.  
  65. class CredSection {
  66.  
  67.  public :
  68.   static int credSectCnt;
  69.   static ulong totalCredHeight;
  70.   short   xoff;
  71.   short   yoff;
  72.   int     lMargin;
  73.   int     rMargin;
  74.   int     size;
  75.   float   spacing;
  76.   int     credCnt;
  77.   Image   image[100];
  78.   enum credSectType credType;
  79.  
  80.  CredSection(void) {};
  81.  void setLMargin(int);
  82.  void setRMargin(int);
  83. };
  84.  
  85. class CredImage : public CredSection  {
  86.  public : 
  87.    
  88.   CredImage(int, int, int, int, ulong *);  
  89. };
  90.  
  91.  
  92. class CredFont : public CredSection {
  93.  float   mat[2][2];
  94.  int     credOff;
  95.  char   *credStr[80];
  96.  char   *fontFamily;
  97.  char   *fontCname;
  98.  float   fontAngle;
  99.  int     fontID;
  100.  
  101.  public:
  102.  
  103.   fmfontinfo finfo;
  104.   char   *fontJust;
  105.   long    fontColor;
  106.   
  107.   CredFont(char *fFamily, int fsize, long fcolor, char *fjust, 
  108.                float fangle, float fspacing);  
  109.   void addStr(char *str);
  110.   char *getStr(int cur);
  111.   void loadFontEnv();
  112. };
  113.  
  114.